package main

import (
	"bytes"
	"fmt"
	"sync"
)

var NewBuffer = func() interface{} {
	return new(bytes.Buffer)
}
var buffer =sync.Pool{
	New:NewBuffer,
}
func GetBuffer() *bytes.Buffer {
	return buffer.Get().(*bytes.Buffer)
}
func PutBuffer(buf *bytes.Buffer) {
	buf.Reset()
	buffer.Put(buf)
}

func main(){
	buffer.Put("hello")
	s := buffer.Get()
	fmt.Println(s)
}